<?php
$DSYIH5E;
$_GET['mod'] = $_GET['mod'] ?? '';
goto YB9NmVUFWT;
AZIDNnpPiK:
goto ysKAv8EFr9;
UFhNetioSS:
goto vb8Nak1LrQ;
vb8Nak1LrQ:
if (!($_GET['mod'] == 'edit')) {
    goto CJgtLDBIOW;
}
goto eKtdUDOm6O;
eKtdUDOm6O:
goto VtIpRyksHx;
CJgtLDBIOW:
echo '<div class="row">
    <div class="col-lg-12">
        <div class="card">
            <div class="card-header">
                用户列表&nbsp;&nbsp;&nbsp;<a href="javascript:searchClear()" class="badge badge-danger-info" title="刷新用户列表"><i class="layui-icon layui-icon-refresh"></i> 刷新</a>
            </div>
            <div class="card-body">
                <div class="layui-elem-quote" id="blocktitle"></div>
                <form onsubmit="return searchOrder()" method="GET" class="form layui-form">
                    <div class="form-group mb-3">
                        <select class="form-control" name="type"><option value="1">用户ID</option><option value="2">用户名</option><option value="3">用户QQ</option></select>
                    </div>
                    <div class="form-group mb-3" id="searchword">
                        <input type="text" class="form-control" name="kw" placeholder="搜索内容" value="">
                    </div>
                     <div class="form-group mb-3">
                        <button class="btn btn-outline-primary" type="submit"><i class="layui-icon layui-icon-search"></i> 搜索</button>&nbsp;
                        <a href="userlist.php?mod=add" class="btn btn-outline-secondary"><i class="layui-icon layui-icon-add-circle"></i> 添加用户</a>
                    </div>
                </form>
            <div id="listTable"></div>
        </div>
    </div>
</div>
';
include_once './bottom.php';
goto z4opHQviLe;
goto m8KEr7xt_V;
EqJC4WzT6m:
z4opHQviLe:
goto EzKdcUoZp_;
ZCt3XLAedS:
goto z4opHQviLe;
VtIpRyksHx:
goto UGT7847yH8;
YB9NmVUFWT:
goto d3VzGKigRH;
v7zPTIE5Rq:
echo $row['power'] == 0x001 ? 'selected ' : '';
echo 'value="1">普通用户</option><option ';
echo $row['power'] == 0x0002 ? 'selected ' : '';
goto w3Y0fMSt01;
l44ph8rN7G:
if (!($islogin == 0x001)) {
    goto Qjqlb4xFQc;
}
goto Vi2lO6L4V7;
Qjqlb4xFQc:
exit('<script language=\'javascript\'>window.location.href=\'./login.php\';</script>');
goto mfukKNlAYI;
goto u9Kd83xs3Z;
EW01D7Pp73:
goto ExHEaFxnjA;
ExHEaFxnjA:
echo $row['qq'];
echo '" lay-verType="tips" lay-verify="required">
                    </div>
                    <div class="form-group mb-3">
                        <label for="example-input-normal" style="font-weight: 500">重置密码：</label>
                        <input type="text" class="form-control" name="pwd" placeholder="不重置请留空">
                    </div>
        <button type="submit" class="btn btn-block btn-xs btn-outline-success" lay-submit lay-filter="submit_useredit">修 改</button>
                </form>
<br>
<a href="./userlist.php">>>返回用户列表</a>
            </div>
        </div>
    </div>
</div>
';
include_once './bottom.php';
goto o60yypqwuX;
KNZ1Yn2LdW:
mfukKNlAYI:
$title = '用户列表';
include_once './head.php';
$endtime = date('Y-m-d', strtotime('+1 months'));
if (!($_GET['mod'] == 'add')) {
    goto UFhNetioSS;
}
goto AZIDNnpPiK;
uBue_j2acH:
echo '" required> <pre>贵族用户有效,普通用户无效 </pre>
</div>
                    <div class="form-group mb-3">
                        <label for="example-input-normal" style="font-weight: 500">用户名：</label>
                        <input type="text" class="form-control" name="user" lay-verType="tips" lay-verify="required">
                    </div>
                    <div class="form-group mb-3">
                        <label for="example-input-normal" style="font-weight: 500">用户密码：</label>
                        <input type="text" class="form-control" name="pwd" value="123456" lay-verType="tips" lay-verify="required">
                    </div>
                    <div class="form-group mb-3">
                        <label for="example-input-normal" style="font-weight: 500">用户余额：</label>
                        <input type="text" class="form-control" name="rmb" value="0" lay-verType="tips" lay-verify="required">
                    </div>
                    <div class="form-group mb-3">
                        <label for="example-input-normal" style="font-weight: 500">用户Q Q：</label>
                        <input type="number" class="form-control" name="qq" lay-verType="tips" lay-verify="required">
                    </div>
                    <button type="submit" class="btn btn-block btn-xs btn-outline-success" lay-submit lay-filter="submit_adduser">添 加</button>
              </form>
<br>
<a href="./userlist.php">>>返回用户列表</a>
          </div>
        </div>
    </div>
</div>
';
include_once './bottom.php';
echo '<script type="text/javascript">
layui.use([\'form\'], function () {
    var form = layui.form;
    form.on(\'submit(submit_adduser)\', function (data) {
        layer.alert(\'是否要执行当前操作？\', {
            icon: 3, btn: [\'确定\', \'取消\'], btn1: function (layero, index) {
                adduser();
            }
        });
        return false;
    });
});
function adduser() {
    var power = $("select[name=\'power\']").val();
    var user = $("input[name=\'user\']").val();
    var pwd = $("input[name=\'pwd\']").val();
    var rmb = $("input[name=\'rmb\']").val();
    var qq = $("input[name=\'qq\']").val();
    var endtime = $("input[name=\'endtime\']").val();
    if (qq.length < 5 || qq.length > 10 || isNaN(qq)) {
        layer.msg(\'请输入5~10位QQ账号\', {icon: 5});
        return false;
    }
    var ii = layer.msg(\'正在添加中,请稍后...\', {icon: 16, time: 10 * 1000});
    $.ajax({
        type: "POST",
        url: "ajax.php?act=adduser",
        data : {power:power,user:user,rmb:rmb,qq:qq,pwd:pwd,endtime:endtime},
        dataType: "json",
        success: function(data) {
            layer.close(ii);
            if (data.code == 0) {
                layer.msg(data.msg, {
                    icon: 6,
                    end: function (layero, index) {
                        window.location.href = \'userlist.php\';
                    }
                });
            } else {
                layer.msg(data.msg, {icon: 5});
            }
        },
        error:function(data){
            layer.msg(\'服务器错误\', {icon: 5});
            return false;
        }
    });
    return false;
};
</script>
';
goto ZCt3XLAedS;
ZUnKg5KUBa:
goto CwBchwTplL;
u9Kd83xs3Z:
Vi2lO6L4V7:
goto lVHJYZnCca;
gssuOliIef:
echo '<div class="row">
    <div class="col-lg-12">
        <div class="card">
            <div class="card-header">
                添加用户
            </div>
            <div class="card-body">
                <form class="form-horizontal layui-form">
                    <div class="form-group mb-3">
                        <label for="example-input-normal" style="font-weight: 500">用户权限：</label>
                        <select name="power" class="form-control" ><option value="1">普通用户</option><option value="2">贵族用户</option></select>
                    </div>
                    <div class="form-group mb-3">
<label for="example-input-normal" style="font-weight: 500">到期时间：</label>
<input type="date" class="form-control"  id="addsite_datetime" name="endtime" value="';
echo $endtime;
goto uBue_j2acH;
CwBchwTplL:
echo '" required>
<pre>贵族用户有效,普通用户无效 </pre>
</div>                   
                    <div class="form-group mb-3">
                        <label for="example-input-normal" style="font-weight: 500">用户名：</label>
                        <input type="text" class="form-control" name="user" value="';
echo $row['user'];
echo '" lay-verType="tips" lay-verify="required">
                    </div>
                    <div class="form-group mb-3">
                        <label for="example-input-normal" style="font-weight: 500">用户余额：</label>
                        <input type="text" class="form-control" name="rmb" value="';
echo $row['rmb'];
echo '" lay-verType="tips" lay-verify="required">
                    </div>
                    <div class="form-group mb-3">
                        <label for="example-input-normal" style="font-weight: 500">用户Q Q：</label>
                        <input type="number" class="form-control" name="qq" value="';
goto EW01D7Pp73;
UGT7847yH8:
$zid = $_GET['zid'];
$row = $DB->get_row("\123\105\x4c\105\x43\124\x20\x2a\40\x46\x52\x4f\115\40\x6d\145\151\x68\x65\137\165\163\145\x72\x20\x57\x48\x45\122\x45\x20\x7a\x69\144\75\x27{$zid}\47\40\154\151\x6d\x69\x74\40\61");
echo '<div class="row">
    <div class="col-lg-12">
        <div class="card">
            <div class="card-header">
                编辑授权
            </div>
            <div class="card-body">
                <form class="form-horizontal layui-form">
                    <div class="form-group mb-3">
                        <label for="example-input-normal" style="font-weight: 500">用户权限：</label>
                        <select name="power" class="form-control" ><option ';
goto v7zPTIE5Rq;
lVHJYZnCca:
goto KNZ1Yn2LdW;
m8KEr7xt_V:
ysKAv8EFr9:
goto gssuOliIef;
EzKdcUoZp_:
goto hjq9_hvK62;
w3Y0fMSt01:
echo 'value="2">贵族用户</option></select>
                    </div>       
               <div class="form-group mb-3">
<label for="example-input-normal" style="font-weight: 500">到期时间：</label>
<input type="date" class="form-control" name="endtime" value="';
echo date('Y-m-d', strtotime($row['endtime']));
goto ZUnKg5KUBa;
d3VzGKigRH:
include_once '../meihe/common.php';
goto l44ph8rN7G;
o60yypqwuX:
echo '<script type="text/javascript">
layui.use([\'form\'], function () {
    var form = layui.form;
    form.on(\'submit(submit_useredit)\', function (data) {
        layer.alert(\'是否要执行当前操作？\', {
            icon: 3, btn: [\'确定\', \'取消\'], btn1: function (layero, index) {
                useredit();
            }
        });
        return false;
    });
    form.on(\'select(power)\', function(data){ 
        if(data.value == \'1\' || data.value == \'2\'){
            $("#frame_set1").show();
        }else{
            $("#frame_set1").hide();
        }
    });
});
function useredit() {
    var power = $("select[name=\'power\']").val();
    var user = $("input[name=\'user\']").val();
    var rmb = $("input[name=\'rmb\']").val();
    var qq = $("input[name=\'qq\']").val();
    var pwd = $("input[name=\'pwd\']").val();
    var endtime = $("input[name=\'endtime\']").val();
    if (qq.length < 5 || qq.length > 10 || isNaN(qq)) {
        layer.msg(\'请输入5~10位QQ账号\', {icon: 5});
        return false;
    }
    var ii = layer.msg(\'正在修改中,请稍后...\', {icon: 16, time: 10 * 1000});
    $.ajax({
        type: "POST",
        url: "ajax.php?act=useredit&zid=';
echo $zid;
goto cKMkLtbEYf;
cKMkLtbEYf:
echo '",
        data : {power:power,user:user,rmb:rmb,qq:qq,pwd:pwd,endtime:endtime},
        dataType: "json",
        success: function(data) {
            layer.close(ii);
            if (data.code == 0) {
                layer.msg(data.msg, {
                    icon: 6,
                    end: function (layero, index) {
                        window.location.reload();
                    }
                });
            } else {
                layer.msg(data.msg, {icon: 5});
            }
        },
        error:function(data){
            layer.msg(\'服务器错误\', {icon: 5});
            return false;
        }
    });
    return false;
};
</script>
';
goto EqJC4WzT6m;
hjq9_hvK62:
echo '<script type="text/javascript">
function listTable(query){
    var url = window.document.location.href.toString();
    var queryString = url.split("?")[1];
    query = query || queryString;
    if(query == \'start\' || query == undefined){
        query = \'\';
        history.replaceState({}, null, \'./userlist.php\');
    }else if(query != undefined){
        history.replaceState({}, null, \'./userlist.php?\'+query);
    }
    layer.closeAll();
    var ii = layer.msg(\'正在获取用户列表中,请稍后...\', {icon: 16, time: 10 * 1000});
    $.ajax({
        type : \'GET\',
        url : \'userlist-table.php?\'+query,
        dataType : \'html\',
        cache : false,
        success : function(data) {
            layer.close(ii);
            $("#listTable").html(data)
        },
        error:function(data){
            layer.msg(\'服务器错误\', {icon: 5});
            return false;
        }
    });
}
function searchOrder(){
    var type=$("select[name=\'type\']").val();
    var kw=$("input[name=\'kw\']").val();
    var method=$("select[name=\'method\']").val();
    if(kw==\'\'){
        listTable(\'start\');
    }else{
        listTable(\'type=\'+type+\'&kw=\'+kw+\'&method=\'+method);
    }
    return false;
}
function searchClear(){
    $("select[name=\'type\']").val(0);
    $("input[name=\'kw\']").val(\'\');
    $("select[name=\'method\']").val(0);
    listTable(\'start\');
}
function recharge(zid){
    var body=\'<div class="form-group"><select class="form-control" id="actdo"><option value="0">加款</option><option value="1">扣款</option></select></div><input type="text" id="rmb" placeholder="请输入金额" class="form-control">\';
    layer.confirm(body,{title:"余额充值",btn: [\'确定\',\'取消\']}, function(){
        var actdo=$("#actdo").val();
        var rmb=$("#rmb").val();
        if(rmb==\'\'){
            layer.msg(\'请输入金额\', {icon: 5});
            return false;
        }
        var ii = layer.msg(\'正在操作中,请稍后...\', {icon: 16, time: 10 * 1000});
        $.ajax({
            type : "POST",
            url : "ajax.php?act=user_recharge",
            data : {zid:zid,actdo:actdo,rmb:rmb},
            dataType : \'json\',
            success : function(data) {
                layer.close(ii);
                if(data.code == 0){
                    layer.msg(\'修改余额成功!\', {
                        icon: 6,
                        end: function (layero, index) {
                            listTable();
                        }
                    });
                } else {
                    layer.msg(data.msg, {icon: 5});
                }
            },
            error:function(data){
                layer.close(ii);
                layer.msg(\'服务器错误\', {icon: 5});
                return false;
            }
        });
    });
}
function Active(type,zid) {
    $.ajax({
        type : \'GET\',
        url : \'ajax.php?act=user_\'+type+\'&zid=\'+zid,
        dataType : \'json\',
        success : function(data) {
        },
        error:function(data){
            layer.msg(\'服务器错误\', {icon: 5});
            return false;
        }
    });
}
function czpass(zid) {
    var confirmobj = layer.confirm(\'你确实要将此用户的密码重置为123456吗？\', {
      btn: [\'确定\',\'取消\']
    }, function(){
        var ii = layer.msg(\'正在重置中,请稍后...\', {icon: 16, time: 10 * 1000});
        $.ajax({
            type : \'GET\',
            url : \'ajax.php?act=user_czpass&zid=\'+zid,
            dataType : \'json\',
            success : function(data) {
                layer.close(ii);
                if(data.code == 0){
                    layer.msg(data.msg, {
                        icon: 6,
                        end: function (layero, index) {
                            listTable();
                        }
                    });
                } else {
                    layer.msg(data.msg, {icon: 5});
                }
            },
            error:function(data){
                layer.msg(\'服务器错误\', {icon: 5});
                return false;
            }
        });
    }, function(){
        layer.close(confirmobj);
    });
}
function userdel(zid) {
    var confirmobj = layer.confirm(\'你确实要删除此用户吗？\', {
      btn: [\'确定\',\'取消\']
    }, function(){
      $.ajax({
        type : \'GET\',
        url : \'ajax.php?act=userdel&zid=\'+zid,
        dataType : \'json\',
        success : function(data) {
            if(data.code == 0){
                layer.msg(data.msg, {
                    icon: 6,
                    end: function (layero, index) {
                        listTable();
                    }
                });
            } else {
                layer.msg(data.msg, {icon: 5});
            }
        },
        error:function(data){
            layer.msg(\'服务器错误\', {icon: 5});
            return false;
        }
      });
    }, function(){
      layer.close(confirmobj);
    });
}
function sso(zid) {
    var confirmobj = layer.confirm(\'确定是否登录该用户后台？\', {
      btn: [\'确定\',\'取消\']
    }, function(){
        var ii = layer.msg(\'正在登录中,请稍后...\', {icon: 16, time: 10 * 1000});
        $.ajax({
            type : \'GET\',
            url : \'ajax.php?act=sso&zid=\'+zid,
            dataType : \'json\',
            success : function(data) {
                layer.close(ii);
                if(data.code == 0){
                    layer.msg(data.msg, {
                        icon: 6,
                        end: function (layero, index) {
                            window.open("../user");
                        }
                    });
                } else {
                    layer.msg(data.msg, {icon: 5});
                }
            },
            error:function(data){
                layer.msg(\'服务器错误\', {icon: 5});
                return false;
            }
        });
    }, function(){
        layer.close(confirmobj);
    });
}
function setEndtime(zid) {
	layer.prompt({title: \'需要延时多少个月\', value: \'12\', formType: 0}, function(text, index){
		$.ajax({
			type : \'POST\',
			url : \'ajax.php?act=setEndtime\',
			data : {zid:zid,month:text},
			dataType : \'json\',
			success : function(data) {
				if(data.code == 0){
					layer.msg(data.msg);
					listTable();
				}else{
					layer.alert(data.msg);
				}
			},
			error:function(data){
				layer.msg(\'服务器错误\');
				return false;
			}
		});
	});
}
$(document).ready(function(){
    var items = $("select[default]");
    for (i = 0; i < items.length; i++) {
        $(items[i]).val($(items[i]).attr("default")||0);
    }
    listTable();
})
</script>';
